<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>原型链</title>
</head>
<body>

</body>
<script>

     function SuperType() {// 父类
         this.name = "Lee";
         this.colors = ['white']

     }

     SuperType.prototype.sayHello=function () {
         alert("hello:"+this.name);
     }

     function SubType() { // 子类

     }

      /*
      * *  当属性是引用类型
      *       使用创建原型创建的实例，共享它们的变化
      * */
     SubType.prototype =new SuperType();
   /*   =  {
          this.name = "Lee";
      }*/

     var sub1 = new SubType();
     var sub2 = new SubType();

     sub1.colors.push('green')
     /*alert(sub1.name);
     alert(sub2.name);*/
    // sub1.sayHello();

    console.log(sub2.colors);

</script>
</html>